package com.itheima.tcp1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author Anomaly
 * @date 2023/2/11 15:10
 */
public class Server {
    public static void main(String[] args) throws Exception {
        System.out.println("==============服务端启动=================");
        ServerSocket serverSocket = new ServerSocket(7777);
        Socket socket = serverSocket.accept();
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String msg;
        if ((msg = br.readLine()) != null) {
            System.out.println("收到来自：" + socket.getRemoteSocketAddress() + "的消息：" + msg);
        }
    }
}
